<?php
/**
 * Translator default controller
 *
 * @package		yos_translator
 * @subpackage	Components
 * @link		http://yopensource.com
 * @author		Minh Nguyen
 * @copyright 	Minh Nguyen (minhna@gmail.com)
 * @license		Commercial
 */

jimport('joomla.application.component.controller');
//if(!class_exists('FVBContentHelperRoute')) require_once (JPATH_BASE . '/components/com_feed_manager/helpers/route.php');
require_once ('helpers/fvb_utility.php');
/**
 * Translator Component Controller
 *
 * @package		yos_translator
 */
class FVBController extends JController
{
	function __construct(){
		
		//set default view to about
		if (!JRequest::getVar('task') && !JRequest::getVar('view')) {
//			JRequest::setVar('task', 'contents');
		}
		parent::__construct();
		
	}
	function works(){
		global $mainframe;
		
		//get default execution time
		$defalutExecution = ini_get('max_execution_time');
		//trying to set limit to 2 minutes, because I will run the cronjob every 5 minutes
		@set_time_limit(60 * 30);
		
		$model =& $this->getModel('works');
		
		if (JRequest::getInt('debug')) { echo date('H:i:s')."[CONTROLLER] created model object<br />\n"; }
		if (JRequest::getInt('debug')) { echo date('H:i:s')."[CONTROLLER] task works BEGIN<br />\n"; }
		$model->works();
		if (JRequest::getInt('debug')) { echo date('H:i:s')."[CONTROLLER] task works END<br />\n"; }
		
		if ($arr_errors = $model->getErrors()) {
			foreach ($arr_errors as $str_error){
				echo '<font color="red">[ERROR]</font> '.$str_error.'<br />';
			}
		}
		//restore default setting
		@set_time_limit($defalutExecution);
		die();
	}
}
?>
